package gov.pr.celepar.sentinela.admin.facade;

import java.util.Collection;

import gov.pr.celepar.sentinela.admin.dao.RestricaoIPDAO;
import gov.pr.celepar.sentinela.admin.dao.factory.DAOFactoryServer;
import gov.pr.celepar.sentinela.admin.excecao.SentinelaServerException;
import gov.pr.celepar.sentinela.admin.pojo.RestricaoIP;
import gov.pr.celepar.sentinela.admin.pojo.RestricaoIPGrupoSistema;
import gov.pr.celepar.sentinela.admin.pojo.RestricaoIPSistema;

public class RestricaoIPFacade {

	public static Collection<RestricaoIP> getRestricoesIPSistema(Long codSistema)
			throws SentinelaServerException, Exception {
		RestricaoIPDAO restricaoDao = DAOFactoryServer.getDAOFactory()
				.getRestricaoIPDAO();

		Collection<RestricaoIP> restricoes = restricaoDao
				.listarRestricoesIPSistema(codSistema);

		return restricoes;

	}

	public static Collection<RestricaoIP> getRestricoesIPGrupo(Long codSistema)
			throws SentinelaServerException, Exception {
		RestricaoIPDAO restricaoDao = DAOFactoryServer.getDAOFactory()
				.getRestricaoIPDAO();

		Collection<RestricaoIP> restricoes = restricaoDao
				.listarRestricoesIPGrupoSistema(codSistema);

		return restricoes;

	}

	public static void salvar(RestricaoIPSistema restricaoIPSistema)
			throws SentinelaServerException, Exception {
		DAOFactoryServer.getDAOFactory().getRestricaoIPDAO().incluir(
				restricaoIPSistema);
	}

	public static RestricaoIPSistema getRestricaoIPSistema(Long codRestricao,
			Long codSistema) throws SentinelaServerException, Exception {
		return DAOFactoryServer.getDAOFactory().getRestricaoIPDAO()
				.obterRestricaoIPSistema(codRestricao, codSistema);
	}

	public static void alterar(RestricaoIPSistema restricaoIPSistema)
			throws SentinelaServerException, Exception {
		DAOFactoryServer.getDAOFactory().getRestricaoIPDAO().alterar(
				restricaoIPSistema);
	}

	public static void excluir(RestricaoIPSistema restricaoIPSistema)
			throws SentinelaServerException, Exception {
		DAOFactoryServer.getDAOFactory().getRestricaoIPDAO().excluir(
				restricaoIPSistema);
	}

	public static void salvar(RestricaoIPGrupoSistema restricaoIPGrupo)
			throws SentinelaServerException, Exception {
		DAOFactoryServer.getDAOFactory().getRestricaoIPDAO().incluir(
				restricaoIPGrupo);
	}

	public static RestricaoIPGrupoSistema getRestricaoIPGrupo(
			Long codRestricao, Long codSistema)
			throws SentinelaServerException, Exception {
		return DAOFactoryServer.getDAOFactory().getRestricaoIPDAO()
				.obterRestricaoIPGrupo(codRestricao, codSistema);
	}

	public static void alterar(RestricaoIPGrupoSistema restricaoIPGrupo)
			throws SentinelaServerException, Exception {
		DAOFactoryServer.getDAOFactory().getRestricaoIPDAO().alterar(
				restricaoIPGrupo);
	}

	public static void excluir(RestricaoIPGrupoSistema restricaoIPGrupo)
			throws SentinelaServerException, Exception {
		DAOFactoryServer.getDAOFactory().getRestricaoIPDAO().excluir(
				restricaoIPGrupo);
	}
}
